Page({
  data: {
    categoryName: '',
    products: [],
    carouselImages: [
      '/images/carousel1.jpg',
      '/images/carousel2.jpg',
      '/images/carousel3.jpg'
    ]
  },

  onLoad: function(options) {
    const categoryId = options.id;
    // 根据categoryId获取分类名称和商品列表
    this.setData({
      categoryName: '蛋糕',
      products: [
        { id: 1, name: '草莓蛋糕', image: '/images/cake1.jpg', price: 30 },
        { id: 2, name: '巧克力蛋糕', image: '/images/cake2.jpg', price: 40 }
      ]
    });
  },

  goToProduct: function(e) {
    const productId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/product/product?id=' + productId
    });
  }
});
